package com.cyzy.educationalai.sercive.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cyzy.educationalai.mapper.ChatServiceMapper;
import com.cyzy.educationalai.pojo.Course;
import com.cyzy.educationalai.sercive.ChatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author zxw
 * @create 2025-05-22 上午9:11
 */
@Service
public class ChatServiceImpl implements ChatService {
    @Autowired
    private ChatServiceMapper chatServiceMapper;
    @Override
    public List<String> getCourseDescriptions() {
        QueryWrapper<Course> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("course_description");

        // 使用selectObjs获取特定列的值
        return chatServiceMapper.selectObjs(queryWrapper)
                .stream()
                .map(obj -> (String) obj)
                .collect(Collectors.toList());
    }
}
